package jcu.salt.io;

import com.rbnb.sapi.ChannelMap;

/**
 * Provides some implementation to access attributes necessary for the 
 * connection of a data turbine.
 * 
 * @see DataTurbineReadConnector
 * @see DataTurbineWriteConnector
 * 
 * @author SAL-T team
 *
 */

public abstract class DataTurbineConnector {

	private String hostName;
	private String sourceName;
	private String channelName;
	
	private boolean connected;
	private ChannelMap cmap;
	private int chanIndex;

	protected final static String MIMETYPE = "application/octet-stream";
	
	public DataTurbineConnector(String host, String source, String channel) {
		setHost(host);
		setSource(source);
		setChannel(channel);
		
		setConnected(false);		
		setChannelIndex(0);
		cmap = new ChannelMap();		
	}
	
	protected ChannelMap getChannelMap() {
		return cmap;
	}
	
	protected void setChannelMap(ChannelMap cmap) {
		this.cmap = cmap;
	}
	

	private void setHost(String host) {
		this.hostName = host;
	}

	public String getHost() {
		return hostName;
	}

	private void setSource(String source) {
		this.sourceName = source;
	}

	public String getSource() {
		return sourceName;
	}

	private void setChannel(String channel) {
		this.channelName = channel;
	}

	public String getChannel() {
		return channelName;
	}


	protected void setChannelIndex(int idx) {
		this.chanIndex = idx;
	}


	protected int getChannnelIndex() {
		return chanIndex;
	}


	protected void setConnected(boolean connected) {
		this.connected = connected;
	}


	public boolean isConnected() {
		return connected;
	}

}